<?php
$encoding_mode = null;
if( extension_loaded( 'zlib' ) ){
    
    if( strpos( $_SERVER[ 'HTTP_HEADERS' ][ 'Accept-Encoding' ], 'gzip' ) !== false ){
        header( 'Content-Encoding: gzip');
        $encoding_mode = FORCE_GZIP;
    }
    else if ( strpos( $_SERVER[ 'HTTP_HEADERS' ][ 'Accept-Encoding' ], 'deflate' ) !== false ){
        header( 'Content-Encoding: deflate');
        $encoding_mode = FORCE_DEFLATE;
    }
}

$content = '';
foreach( $this->files as $f ){
    $content .= file_get_contents( $f );
}

if( $encoding_mode !== null ){
    echo gzencode( $content, -1, $encoding_mode );
}
else{
    echo $content;
}
    

